<?php

 /*
  * PARENT INFORMER: Joseph Betansos, Carl Dizon, Karlo Garcia,
  *                  Aljero Jimenez, Ronaldo Sales
  * @date: 2/28/2011
  *
  * @getsubjs.php: This PHP document retrieves a list of suggested
  *                subjects once the user types a letter or word.
  *
  */

 $myquery = $_GET['q'];
 $myquery = strtoupper($myquery);
 
 $subjxml = simplexml_load_file("../xml/subjects.xml") or die("Sorry. Cannot load XML file.");
 $allsubjs = $subjxml->xpath('//name');
 
 foreach($allsubjs as $x) {
  if(substr($x, 0, strlen($myquery)) == $myquery) {
   echo "<a href=javascript:includeme('".str_replace(' ', '_', $x)."')>".$x."</a><br>";
  }
 }

?>